package com.xucy.springboot.designmodel.behavioral.observer;

import lombok.Getter;
import lombok.Setter;

import java.util.Observable;

/**
 * @Author xucy
 * @Date 2019-07-28 11:30
 * @Description
 **/
@Getter
@Setter
public class Course  extends Observable {

    private String courseName;


    public Course(String courseName) {
        this.courseName = courseName;
    }

    /**
     * 提交课程
     *
     * @Author xucy
     * @Date 11:33 2019-07-28
     * @param
     * @return
     */
    public void commitQuestion(Course course,Question question){
        System.out.println(question.getQuestionName()+"提交了一个问题");

        //改变是否有改变
        setChanged();

        //通知观察者们
        notifyObservers(question);
    }
}
